package com.scanner.util;

import com.scanner.bean.Constans;

public class SharePreConfig {
    public static final String BAUDRATE = "baud_rate_jsb";
    public static final String ISFIRSTOPEN = "first";
    public static final String DEVICETYPE = "device_type";

    public static final String QIANZHUI = "qianzhui";
    public static final String HOUZUI = "houzui";

    public static final String ALWAYSLINGHT = "always_light";


    public static final String BULETOOTHSCAN = "blue_tooth_scan";

    public static final String VOICECHOOSE = "voice_choose";
    public static final String XUANFuScan = "suspension_scan_btn";

    public static final String SCANSETTING = "scan_setting";


    private static SharePreUtils sharePreUtils = SharePreUtils.getInstance();


    public static void setVoiceChoosePos(int pos){
        sharePreUtils.put(VOICECHOOSE,pos);
    }

    public static int getVoiceChoosePos(){
        return sharePreUtils.getInt(VOICECHOOSE,0);
    }


    public static void setBluetoothScan(boolean state){
        sharePreUtils.put(BULETOOTHSCAN,state);
    }

    public static boolean getBlueTothScanState(){
        return sharePreUtils.getBoolean(BULETOOTHSCAN,false);
    }



    public static void setXuanFuKeyScan(boolean state){
        sharePreUtils.put(XUANFuScan,state);
    }

    public static boolean getXuanFuKeyScanState(){
        return sharePreUtils.getBoolean(XUANFuScan,false);
    }


    /**
     * 设置波特率
     */
    public static void setBaudRate(int baudRate){
        sharePreUtils.put(BAUDRATE,baudRate);
    }

    /**
     * 返回波特率
     * 默认115200
     * @return
     */
    public static int getBaudRate(){
        return sharePreUtils.getInt(BAUDRATE,115200);
    }


    /**
     * 是否第一次打开
     * @param login
     */
    public static void setIsFirstOpen(boolean login){
        sharePreUtils.put(ISFIRSTOPEN,login);
    }

    public static boolean getIsFirstOpen(){
        return sharePreUtils.getBoolean(ISFIRSTOPEN,true);
    }

    //设置和获取设备类型
    public static void setDeviceType(int type){
        sharePreUtils.put(DEVICETYPE,type);
    }

    private static int getDeviceType(){
        return sharePreUtils.getInt(DEVICETYPE, Constans.DTMoToSE655);
    }



    public static void setQianZui(String qz){
        sharePreUtils.put(QIANZHUI,qz);
    }

    public static String getQianzhui(){
        return sharePreUtils.getString(QIANZHUI,"");
    }

    public static void setHouZui(String qz){
        sharePreUtils.put(HOUZUI,qz);
    }

    public static String getHouzhui(){
        return sharePreUtils.getString(HOUZUI,"");
    }


    public static void setAlwaysLight(boolean isOpen){
        sharePreUtils.put(ALWAYSLINGHT,isOpen);
    }

    public static boolean getAlawysLight(){
        return sharePreUtils.getBoolean(ALWAYSLINGHT,false);
    }



    public static void setScanSetting(String settingGson){
        sharePreUtils.put(SCANSETTING,settingGson);
    }

    public static String getScanSetting(){
        return sharePreUtils.getString(SCANSETTING,"");
    }


}
